package Year2021.Month11.Day1Homework;

public class Teacher {
    private String school;
    private String name;
    private int age;

    public Teacher(String school, String name, int age) {
        this.school = school;
        this.name = name;
        this.age = age;
    }

    public void setAge(int age1) throws Exception {
        if (age1 >= 23) {
            this.age = age1;
        } else {
            throw new Exception("年龄不得少于23岁");
        }
    }

    public void attendClass() {
        System.out.println("来给同学们上课了！");
    }

    public void show() {
        System.out.println("我叫" + name + "\t" + "来自" + school + "\t" + "年龄" + this.age+"岁");
        attendClass();
    }


}
